package indzcraft.loader;
import java.util.HashMap;

public class RaceDB {
	
	HashMap<Integer,Race> raceDB = new HashMap<Integer,Race>();
	
	public RaceDB(){
		populateRaceDB();
	}
	
	public Race getRace(int id){
		if(raceDB.containsKey(id)){
			return raceDB.get(id);
		}
		System.out.println("unknown raceid: "+  id);
		return null;
	}
	
	public Race findByName(String name){
		for(Integer id : raceDB.keySet() ){
			if(raceDB.get(id).getName().equals(name)){
				return raceDB.get(id);
			}
		}
		return null;
	}
	
	private void populateRaceDB() {
		raceDB.put(3, new Race("dwarf",127,202)); // dwarf
		raceDB.put(1, new Race("human",122,206)); // human
		raceDB.put(22, new Race("worgen",125,208)); // worgen
		raceDB.put(7, new Race("gnome",117,208)); // gnome
		raceDB.put(4, new Race("nightelf",118,210)); // nightelf
		raceDB.put(9, new Race("goblin",119,208)); 
		raceDB.put(10, new Race("bloodelf",119,208));
		raceDB.put(2, new Race("orc",125,203)); 
		raceDB.put(5, new Race("undead",121,204)); 
		raceDB.put(8, new Race("troll",123,208)); 
	}
}

